package com.github.east196.terminator.web;

import com.github.east196.terminator.xtend.meta.DocMetaParser;
import com.jfinal.core.Controller;
import com.jfinal.core.Path;
import com.jfinal.json.Json;

@Path("/")
public class AppController extends Controller {

	public void index() {
		renderText("Dev");
	}

	public <T> T getJson(Class<T> jsonClass) {
		String raw = getRawData();
		return Json.getJson().parse(raw, jsonClass);
	}

	public void json() {
		Args args = getJson(Args.class);
		System.out.println(args);
		renderJson(new DocMetaParser().action(args.file));
	}

}